package co.edu.eam.persitencia.entidades;

import java.io.Serializable;
import java.lang.Long;
import java.lang.String;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Entidad que representa la formula medica del paciente.
 *
 */
@NamedQueries({
    @NamedQuery(name=FormulaMedica.CONSULTA_LISTAR_CONSULTA,query=("SELECT formula FROM FormulaMedica formula WHERE formula.consulta.id=:id"+FormulaMedica.PARAMETRO_ID_CONSULTA)),
})
@Entity
@Table(name = "Clinica_FormulaMedica")
public class FormulaMedica implements Serializable {

    public static final String CONSULTA_LISTAR_CONSULTA = "FormulaMedica.ListarConsulta";
    public static final String PARAMETRO_ID_CONSULTA="id";
    /**
     * Identificador unico de la entidad.
     */
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "FormulaMedica_Id")
    private Long id;
    /**
     * Recomendaciones de la formula medica.
     */
    @Column(name = "FormulaMedica_Recomendaciones")
    private String recomendacion;
    /**
     * Consulta a la que esta asociada la formula medica.
     */
    @ManyToOne
    @JoinColumn(name = "FormulaMedica_Consulta")
    private Consulta consulta;
    /**
     * Lista de detalles de formula medica.
     */
    @OneToMany(mappedBy = "formulaMedica")
    private List<DetalleFormulaMedica> detallesFormulaMedica;

    /**
     * Constructor sin parametros.
     */
    public FormulaMedica() {
        super();
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the recomendacion
     */
    public String getRecomendacion() {
        return recomendacion;
    }

    /**
     * @param recomendacion the recomendacion to set
     */
    public void setRecomendacion(String recomendacion) {
        this.recomendacion = recomendacion;
    }

    /**
     * @return the consulta
     */
    public Consulta getConsulta() {
        return consulta;
    }

    /**
     * @param consulta the consulta to set
     */
    public void setConsulta(Consulta consulta) {
        this.consulta = consulta;
    }

    /**
     * @return the detallesFormulaMedica
     */
    public List<DetalleFormulaMedica> getDetallesFormulaMedica() {
        return detallesFormulaMedica;
    }

    /**
     * @param detallesFormulaMedica the detallesFormulaMedica to set
     */
    public void setDetallesFormulaMedica(List<DetalleFormulaMedica> detallesFormulaMedica) {
        this.detallesFormulaMedica = detallesFormulaMedica;
    }
    //TODO:falta toString
}
